<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
		<link rel="stylesheet" href="WEIXIN_URL/css/css_new.css" />
		<title>维修个人信息认证</title>
		<script type="text/javascript" charset="utf-8" src="WEIXIN_URL/js/adaptive-version2.js"></script>
		<script>
			window['adaptive'].desinWidth = 750;
			window['adaptive'].baseFont = 18;
			window['adaptive'].init();
		</script>
		<script src="WEIXIN_URL/js/jquery.min.js"></script>
		<script src="WEIXIN_URL/js/gglb.js"></script>
		<style type="text/css">
		.enter_btn1,.enter_btn2{
			width: 40%;
		    margin-left: 5%;
		    height: 36px;
		    border-radius: 20px;
		    margin-top: 20px;
		    color: #fff;
		}
		a{
			text-decoration: none;
		}
		.pay_mask{
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background: rgba(0,0,0,0.2);
			z-index: 9999;
		}
		.paymask_box{
			width: 85%;
			height: auto;
			background: #fff;
			margin: 30% auto;
			border-radius: 12px;
			padding: 10px;
		}
		.zb{
			height: 30px;
			line-height: 30px;
			font-size: 0.32rem;
		}
		span.fl {
		    float: left;
		    width: 30%;
		}
		span.fr{
			float: left;
			width: 65%;
			border: 1px solid #bbb;
    		background: #efefef;
		}

		</style>
	</head>
	<body style="background:#f3f3f3">
		<div class="head green">
			<a href="javascript:;" onclick="goback()" ><div class="left"></div></a>
			<span>订单详情</span>
			<div class="right">
				<a href="tel:18934597061"><span>客服</span></a>
			</div>
		</div>
		<div class="box_details1">
			<div class="tit1">
				<span>订单号：</span>
				<span>{{$list.order_num}}</span>
				<span>{{$list.create_time|substr=###,0,-3}}</span>
			</div>
			<div class="content1">
				<div class="con1_left">设备名称：</div>
				<div class="con1_right">{{$list.machine_type}}</div>
			</div>
			<div class="content">
				<div class="con1_left">设备名称：</div>
				<div class="con1_right">{{$list.machine_name}}</div>
			</div>
			<div class="content">
				<div class="con1_left">设备型号：</div>
				<div class="con1_right">{{$list.machine_model}}</div>
			</div>
			<div class="content">
				<div class="con1_left">设备地址：</div>
				<div class="con1_right">{{$list.machine_address}}</div>
			</div>
			<div class="schdule">
				<div class="s_tit">派单进度</div>
				<div class="s_content">
					<div name="c_color1" class="gg_color"></div>
					<span class="step">已发报修单</span>
					<span class="time">{{$list.create_time}}</span>
				</div>
				<div class="s_content">
					<div name="c_color2" class="gg_color undone"></div>
					<span class="step">双方沟通中</span>
					<span class="time">{{$list.status2_time}}</span>
				</div>
				<div class="s_content">
					<div name="c_color3" class="gg_color undone"></div>
					<span class="step">确认接单</span>
					<span class="time">{{$list.status3_time}}</span>
				</div>
				<div class="s_content">
					<div name="c_color4" class="gg_color undone"></div>
					<span class="step">付款到平台</span>
					<span class="time">{{$list.status4_time}}</span>
				</div>
				<div class="s_content">
					<div name="c_color5" class="gg_color undone"></div>
					<span class="step">维修方到现场</span>
					<span class="time">{{$list.addrs}}</span>
				</div>
				<div class="s_content">
					<div name="c_color6" class="gg_color undone"></div>
					<span id="step1" class="step">维修完成</span>
					<span class="time display mike_tk">{{$list.status6_time}}</span>
				</div>
				<div class="s_content">
					<div name="c_color7" class="gg_color undone"></div>
					<span id="step" class="step">周期内付款</span>
					<span class="time display mike_tkk" id="fukuan_mike" >30天内付款</span>
				</div>
				<div class="s_content">
					<!-- <div class="gg_color end1"></div> -->
					<div name="c_color8" class="gg_color undone"></div>
					<span class="step">评价</span>
					<span class="time">{{$list.status9_time}}</span>
				</div>
				<div class="line_b b"></div>
				<div class="line_w"></div>
			</div>
		</div>
		<div class="div"  style="margin-bottom: 50px;">
		<a id="enter_btn" href="#">
			<input name="btn" type="button" class=" enter_btn1 green1 display " value="">
		</a>
		<a id="enter_btn1" href="#">
			<input type="button" class="enter_btn2 green1 display" value="">
		</a>
		</div>
		<div style="height: 1px"></div>
		<footer style="z-index: 999">
			<a href="{{:U('Index/index')}}" class="foot_1"><img src="WEIXIN_URL/img/tab_home(1).png" /></a>
			<a href="{{:U('Order/index',array('complete'=>1,'pages'=>'indexa'))}}" class="foot_2"><img src="WEIXIN_URL/img/tab_order_pre(1).png" /></a>
			<a href="{{:U('User/index',array('role'=>$_SESSION['role']))}}" class="foot_3"><img src="WEIXIN_URL/img/tab_person(1).png" /></a>
		</footer>
		<div class="pay_mask" style="display: none">
			<div class="paymask_box">
				 <div class="img_pay" style="">
                    <div class="wenben">
                         <div class="zb">
                             <span class="fl">银行开户名</span>
                             <span class="fr" style="line-height: 18px;margin-bottom: 3px;">苏州艾隆设备安装工程技术有限公司</span>
                             <!-- <input class="fr" type="text" value="苏州艾隆设备安装工程技术有限公司" name="" > -->
                         </div>
                         <div class="zb">
                             <span class="fl">开户行</span>
                             <span class="fr" style="margin-bottom: 3px;">兴业银行</span>
                             <!-- <input type="text" value="兴业银行" disabled="disabled" name=""> -->
                         </div>
                         <div class="zb">
                             <span class="fl">开户支行</span>
                             <span class="fr" style="margin-bottom: 3px;">苏州分行</span>
                             <!-- <input type="text" value="苏州分行" disabled="disabled" name=""> -->
                         </div>
                         <div class="zb">
                             <span class="fl">账户</span>
                             <span class="fr" style="margin-bottom: 3px;">4066 1010 0100 0489 04</span>
                             <!-- <input type="text" value="4066 1010 0100 0489 04" disabled="disabled" name=""> -->
                         </div>
                         <div class="clear"></div>
                    </div>

                    <div class="zfbz" style="width: 100%;height: 126px;overflow: hidden;font-size: 0.32rem;">
                       	<p style="margin-top: 0px;float: left;margin-top: 40px;">支付凭证</p>
                        <img src="HOME_URL/img/add.png" style="float: left;" width="126px" height="126px" class="zfb1" id="" onclick="fileSelect_mm();" />
                        <input type="file" id="mike_zfpz" name="payment" value="" class="filepath" style="display:none" />
                        <input type="hidden" name="mike_zffff" id="mike_zffff" value="">
                    </div>


                    <div class="clear"></div> 
                    <button href="javascript:;" class="abtn" style="text-decoration: none;display: block;margin: 0 auto;" onclick="tijiao()">确认提交</button>
                </div>
			</div>
		</div>
	</body>
</html>
<script src="WEIXIN_URL/js/jquery.min.js"></script>
<script type="text/javascript" src="WEIXIN_URL/js/layer.js"></script> 
<script type="text/javascript" src="ADMIN_URL/lib/laypage/1.2/laypage.js"></script> 
<script src="HOME_URL/js/lrz.all.bundle.js"></script>
<script>
	function fileSelect_mm() {
	    document.getElementById("mike_zfpz").click();
	}
   //图片生成并展示
	$(function(){
		$(document).on('change','.filepath', function(e) {
			var str = $(this).attr("name");
			lrz(this.files[0], {width: 640,quality:0.92})
			.then(function (rst) {
				$.ajax({
					url: "{{:U('Public/upload_zfpz')}}",
					type: 'post',
					data: {image: rst.base64,zd:str},
					dataType: 'json',
					enctype: 'multipart/form-data',
					success: function (data) {
						var obj = eval("("+data+")");
						if (0 == obj.status) {
							alert(obj.content);  
							return false;
						}else{
							var src= obj.url;
							$("input[name="+str+"]").parent().find("img").attr("src",src).width('100px').height('100px').css({'margin-top':'10px','margin-left':'23px'});  
							$("#mike_zffff").val(obj.imgs);
							
						}
					},
					error:function(XMLHttpRequest, textStatus, errorThrown){ //上传失败 
						alert(XMLHttpRequest.status);
						alert(XMLHttpRequest.readyState);
						alert(textStatus);
					}
				});
			})
		});
	});
	function tijiao(){
		var url = "{{:U('Order/mike_zhifu')}}";
		var data = {order_num:"{{$list['order_num']}}",payment:$("#mike_zffff").val()};
		console.log(data.order_num+'---'+data.payment);
		if($("#mike_zffff").val() == ""){
			layer.msg("请上传支付凭证",{icon:2})
			return;
		}
		$.post(url,data,function(res){
			if(res == 200){
				layer.msg('已提交对公支付凭证',{icon:1})
				setTimeout(function(){
					$(".pay_mask").css("display","none");
					location.reload();
				},1000)
			}else{
				layer.msg("提交失败",{icon:2})
				return;
			}
		},"json")
	}

$(function(){
	var i=35;
	var status = "{{$list.status}}";
	// console.log(list[1]);
	//订单状态(1:创建订单，2：双方沟通中，3：确认接单，4：付款到平台，5：维修方到现场，6：维修完成，7：周期内付款，8：评价，9：完成，10：维修未完成，11：受理退款，12：甲方等待乙方确认订单，13：退款成功，14：乙方确认到场,15:退款失败)
	if(status == 1 || status == 2 ){
		$(".line_w").css({height:'210px'});
		$('div[name="c_color2"]').addClass('go_on1').removeClass('undone')
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("前 往 沟 通");
		$('#enter_btn').attr("href","{{:U('Order/ordera_send',array('order_num'=>$list['order_num']))}}");
	}else if(status==12){
		$(".line_w").css({height:'175px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').addClass('go_on1').removeClass('undone')
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("等 待 确 认").css('background','#ccc');
		$('.enter_btn').show().attr("disabled","disabled");
	}else if(status==3){
		$(".line_w").css({height:'140px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').addClass('go_on1').removeClass('undone')
		// $('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("付 款 到 平 台");
		// $('#enter_btn').attr("href","")
		$('.enter_btn1').show().val("对公转账");
		$('#enter_btn').attr("href","javascript:;");
		$('#enter_btn').click(function(){
			$(".pay_mask").css("display","block");
		});
		$('.enter_btn2').show().val("微信支付");
		$('#enter_btn1').attr("href","{{:U('Order/new_pay')}}");
		
	}else if(status==4){
		$(".line_w").css({height:'105px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').addClass('go_on1').removeClass('undone')
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("等 待 维 修 到 场").css('background',"#ccc");
	}else if(status == 14){
		$(".line_w").css({height:'105px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').addClass('go_on1').removeClass('undone')
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("确 认 到 场");
		$('#enter_btn').attr("href","javascript:;");
		$('#enter_btn').click(function(){
			var url = "{{:U('Order/sub5')}}";
			var data = {order_num:"{{$list['order_num']}}"};
			$.post(url,data,function(res){
				var obj = eval("("+res+")");
				if(obj.code == 200){
					layer.msg(obj.msg,{icon:1});
					setTimeout(function(){
						location.reload();
					},1000);
				}else{
					layer.msg(obj.msg,{icon:2});
					setTimeout(function(){
						location.reload();
					},1000);
				}
			},"json");
		})
	}
	else if(status==5){
		$(".line_w").css({height:'70px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').removeClass('undone');
		$('div[name="c_color6"]').addClass('go_on1').removeClass('undone');
		$('.enter_btn1').show().val("已 完 成");
		$('.enter_btn2').show().val("未 完 成");
		$('#enter_btn').attr("href","javascript:;");
		$('#enter_btn1').attr("href","javascript:;");
		$('#enter_btn').click(function(){
			var url = "{{:U('Order/sub6')}}";
			var data = {order_num:"{{$list['order_num']}}",type:1};
			$.post(url,data,function(res){
				var obj = eval("("+res+")");
				if(obj.code == 200){
					layer.msg(obj.msg,{icon:1});
					setTimeout(function(){
						location.reload();
					},1000);
				}else{
					layer.msg(obj.msg,{icon:2});
					setTimeout(function(){
						location.reload();
					},1000);
				}
			},"json");
		})
		$('#enter_btn1').click(function(){
			var url = "{{:U('Order/sub6')}}";
			var data = {order_num:"{{$list['order_num']}}",type:2};
			$.post(url,data,function(res){
				var obj = eval("("+res+")");
				if(obj.code == 200){
					layer.msg(obj.msg,{icon:1});
					setTimeout(function(){
						location.reload();
					},1000);
				}else{
					layer.msg(obj.msg,{icon:2});
					setTimeout(function(){
						location.reload();
					},1000);
				}
			},"json");
		})
	}else if(status == 6|| status==7){
		$(".line_w").css({height:'0px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').removeClass('undone');
		$('div[name="c_color6"]').removeClass('undone');
		$('div[name="c_color7"]').removeClass('undone');
		$('div[name="c_color8"]').addClass('go_on1').removeClass('undone')
		$('input[name="btn"]').removeClass('.enter_btn1').addClass('.enter_btn');
		$('.mike_tk').removeClass('display');
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("立 即 评 价");
		$("#fukuan_mike").show();
		$('#enter_btn').attr("href","{{:U('Order/evaluate',array('order_num'=>$list['order_num'],'partyb_id'=>$list['partyb_id'],'partyb_role'=>$list['partyb_role']))}}");
	}else if(status == 10){
		$(".line_w").css({height:'70px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').removeClass('undone');
		$('div[name="c_color6"]').removeClass('undone');
		$('div[name="c_color7"]').addClass('go_on1').removeClass('undone');
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("申 请 退 款");
		$('#step').text("申请退款");
		$('#step1').text("维修未完成")
		$('.mike_tk').removeClass('display');
		$('.mike_tkk').removeClass('display');
		$('.mike_tk').text("{{$list.status10_time}}")
		$('.mike_tkk').text("")
		$('#enter_btn').attr("href","javascript:;");
		$('#enter_btn').click(function(){
			layer.prompt({title: '请输入退款金额（元）', formType: 0},function(val, index){
				var test_money = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
				if(!test_money.test(val)){
					layer.msg("只能输入小写金额！");
					return;
				}else if(val > {{$list['money']}}){
					layer.msg("您的金额超出已所付金额！");
					return;
				}else{
					var url = "{{:U('Order/sub10')}}";
					var data = {order_num:"{{$list['order_num']}}",tui_money:val};
					console.log(data.order_num+'----'+data.tui_money);
					$.post(url,data,function(res){
						var obj = eval("("+res+")");
						if(obj.code == 200){
							layer.msg(obj.msg,{icon:1});
							setTimeout(function(){
								location.reload();
							},1000);
						}else{
							layer.msg(obj.msg,{icon:2});
							setTimeout(function(){
								location.reload();
							},1000);
						}
					},"json");
				}
			});
		})
	}else if(status == 11){
		$(".line_w").css({height:'70px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').removeClass('undone');
		$('div[name="c_color6"]').removeClass('undone');
		$('div[name="c_color7"]').addClass('go_on1').removeClass('undone');
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("正 在 受 理 中").css({background:'#ccc'});
		$('#step').text("退款");
		$('#step1').text("维修未完成")
		$('.mike_tk').removeClass('display');
		$('.mike_tkk').removeClass('display');
		$('.mike_tk').text("{{$list.status10_time}}")
		$('.mike_tkk').text("{{$list.status11_time}}")
		$('#enter_btn').attr("href","javascript:;");
	}else if(status == 13){
		$(".line_w").css({height:'0px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').removeClass('undone');
		$('div[name="c_color6"]').removeClass('undone');
		$('div[name="c_color7"]').removeClass('undone');
		$('div[name="c_color8"]').addClass('go_on1').removeClass('undone')
		$('input[name="btn"]').removeClass('.enter_btn1').addClass('.enter_btn');
		$('#step').text("退款成功");
		$('#step1').text("维修未完成");
		$('.mike_tk').removeClass('display');
		$('.mike_tkk').removeClass('display');
		$('.mike_tk').text("{{$list.status10_time}}")
		$('.mike_tkk').text("预计7个工作日内到账")
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("立 即 评 价");
		$('#enter_btn').attr("href","{{:U('Order/evaluate',array('order_num'=>$list['order_num'],'partyb_id'=>$list['partyb_id'],'partyb_role'=>$list['partyb_role']))}}");
	}else if(status == 15){
		$(".line_w").css({height:'70px'});
		$('div[name="c_color2"]').removeClass('undone');
		$('div[name="c_color3"]').removeClass('undone');
		$('div[name="c_color4"]').removeClass('undone');
		$('div[name="c_color5"]').removeClass('undone');
		$('div[name="c_color6"]').removeClass('undone');
		$('div[name="c_color7"]').addClass('go_on1').removeClass('undone');
		$('input[name="btn"]').show().removeClass('enter_btn1').addClass('enter_btn').val("重 新 退 款");
		$('#step').text("退款失败").css("color","red");
		$('#step1').text("维修未完成")
		$('.mike_tk').removeClass('display');
		$('.mike_tkk').removeClass('display');
		$('.mike_tk').text("{{$list.status10_time}}")
		$('.mike_tkk').text("{{$list.status15_time}}")
		$('#enter_btn').attr("href","javascript:;");
		$('#enter_btn').click(function(){
			layer.prompt({title: '请输入退款金额（元）', formType: 0},function(val, index){
				var test_money = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
				if(!test_money.test(val)){
					layer.msg("您的金额超出已所付金额！");
					return;
				}else if(val > {{$list['money']}}){
					layer.msg("您的金额超出！");
					return;
				}else{
					var url = "{{:U('Order/sub10')}}";
					var data = {order_num:"{{$list['order_num']}}",tui_money:val};
					console.log(data.order_num+'----'+data.tui_money);
					$.post(url,data,function(res){
						var obj = eval("("+res+")");
						if(obj.code == 200){
							layer.msg(obj.msg,{icon:1});
							setTimeout(function(){
								location.reload();
							},1000);
						}else{
							layer.msg(obj.msg,{icon:2});
							setTimeout(function(){
								location.reload();
							},1000);
						}
					},"json");
				}
			});
		});
	}
})
</script>